Package com.cisco.pt
Interface EncodedBuffer
- All Known Implementing Classes:
PtmpBuffer
public interface EncodedBuffer
Utility interface for encoded data buffers
Data entries are stored according to their encoding implementation, and retrieved as their native types
- Author:
- packettracerexapps@external.cisco.com
-
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Clear buffer of databyte[]copyRawBytes(boolean shouldFlip) Retrieve the buffer contents as an array of bytesvoidflip()Flip buffer to prepare for read or write operationbooleangetBool()Retrieve the next buffer entry as a booleanbytegetByte()Retrieve the next buffer entry as a bytebyteRetrieve the next buffer entry as a raw byte, even in a text bufferchargetChar()Retrieve the next buffer entry as a chardoubleRetrieve the next buffer entry as a doublefloatgetFloat()Retrieve the next buffer entry as a floatintgetInt()Retrieve the next buffer entry as an integerRetrieve the next buffer entry as a IPAddressRetrieve the next buffer entry as a IPV6AddresslonggetLong()Retrieve the next buffer entry as a longRetrieve the next buffer entry as a MACAddressbyte[]Retrieve the remaining buffer contents as an array of bytesshortgetShort()Retrieve the next buffer entry as a shortRetrieve the next buffer entry as a StringgetUUID()Retrieve the next buffer entry as a UUIDLooks at the next buffer without advancingputBool(boolean b) Store a boolean value to the encoded bufferputByte(byte b) Store a byte value to the encoded bufferputByteList(List<Byte> bytes) Store a byte list value to the encoded bufferputChar(char c) Store a char value to the encoded bufferputDouble(double d) Store a double value to the encoded bufferputFloat(float f) Store a float value to the encoded bufferputInt(int i) Store an int value to the encoded bufferStore an IPAddress value to the encoded bufferStore an IPV6Address value to the encoded bufferputLong(long l) Store a long value to the encoded bufferStore a MACAddress value to the encoded bufferputShort(short s) Store a short value to the encoded bufferStore a String value to the encoded bufferputStringAsBytes(byte[] bytes) Store a String value to the encoded buffer as a byte arrayStore a UUID value to the encoded bufferintGet size of remaining buffer datavoidrewind()Rewind buffer to startvoidsetRawBytes(byte[] bytes) Set the contents of an EncodedBuffer with an array of bytes
-
Method Details
-
getByteRaw
byte getByteRaw()Retrieve the next buffer entry as a raw byte, even in a text buffer- Returns:
- byte value
-
getInt
int getInt()Retrieve the next buffer entry as an integer- Returns:
- int value
-
getShort
short getShort()Retrieve the next buffer entry as a short- Returns:
- short value
-
getLong
long getLong()Retrieve the next buffer entry as a long- Returns:
- long value
-
getChar
char getChar()Retrieve the next buffer entry as a char- Returns:
- char value
-
getByte
byte getByte()Retrieve the next buffer entry as a byte- Returns:
- byte value
-
getFloat
float getFloat()Retrieve the next buffer entry as a float- Returns:
- float value
-
getDouble
double getDouble()Retrieve the next buffer entry as a double- Returns:
- double value
-
getString
String getString()Retrieve the next buffer entry as a String- Returns:
- String value
-
peekString
String peekString()Looks at the next buffer without advancing- Returns:
- String value
-
getBool
boolean getBool()Retrieve the next buffer entry as a boolean- Returns:
- boolean value
-
getIPAddress
IPAddress getIPAddress()Retrieve the next buffer entry as a IPAddress- Returns:
- IPAddress value
-
getIPV6Address
IPV6Address getIPV6Address()Retrieve the next buffer entry as a IPV6Address- Returns:
- IPV6Address value
-
getMACAddress
MACAddress getMACAddress()Retrieve the next buffer entry as a MACAddress- Returns:
- MACAddress value
-
getUUID
UUID getUUID()Retrieve the next buffer entry as a UUID- Returns:
- UUID value
-
putByteList
Store a byte list value to the encoded buffer- Parameters:
bytes- byte list value- Returns:
- EncodedBuffer object
-
putInt
Store an int value to the encoded buffer- Parameters:
i- int value- Returns:
- EncodedBuffer object
-
putShort
Store a short value to the encoded buffer- Parameters:
s- short value- Returns:
- EncodedBuffer object
-
putLong
Store a long value to the encoded buffer- Parameters:
l- long value- Returns:
- EncodedBuffer object
-
putChar
Store a char value to the encoded buffer- Parameters:
c- char value- Returns:
- EncodedBuffer object
-
putByte
Store a byte value to the encoded buffer- Parameters:
b- byte value- Returns:
- EncodedBuffer object
-
putFloat
Store a float value to the encoded buffer- Parameters:
f- float value- Returns:
- EncodedBuffer object
-
putBool
Store a boolean value to the encoded buffer- Parameters:
b- boolean value- Returns:
- EncodedBuffer object
-
putDouble
Store a double value to the encoded buffer- Parameters:
d- double value- Returns:
- EncodedBuffer object
-
putString
Store a String value to the encoded buffer- Parameters:
s- String value- Returns:
- EncodedBuffer object
-
putStringAsBytes
Store a String value to the encoded buffer as a byte array- Parameters:
bytes- byte array value- Returns:
- EncodedBuffer object
-
putIPAddress
Store an IPAddress value to the encoded buffer- Parameters:
i- IPAddress value- Returns:
- EncodedBuffer object
-
putIPV6Address
Store an IPV6Address value to the encoded buffer- Parameters:
i- IPV6Address value- Returns:
- EncodedBuffer object
-
putMACAddress
Store a MACAddress value to the encoded buffer- Parameters:
m- MACAddress value- Returns:
- EncodedBuffer object
-
putUUID
Store a UUID value to the encoded buffer- Parameters:
u- UUID value- Returns:
- EncodedBuffer object
-
copyRawBytes
byte[] copyRawBytes(boolean shouldFlip) Retrieve the buffer contents as an array of bytes- Parameters:
shouldFlip- boolean flag to indicate whether to flip the buffer first- Returns:
- byte[] contents of buffer
-
getRawBytes
byte[] getRawBytes()Retrieve the remaining buffer contents as an array of bytes- Returns:
- byte[] contents of buffer from position to limit
-
setRawBytes
void setRawBytes(byte[] bytes) Set the contents of an EncodedBuffer with an array of bytes- Parameters:
bytes- array of bytes
-
clear
void clear()Clear buffer of data -
remaining
int remaining()Get size of remaining buffer data- Returns:
- byte count of remaining data
-
rewind
void rewind()Rewind buffer to start -
flip
void flip()Flip buffer to prepare for read or write operation
-